home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / kiss-0.11 / kiss-0 / kiss / src / morefile.c < prev    next >
C/C++ Source or Header  |  1995-03-23  |  586b  |  36 lines

  1. #include "kiss.h"
  2.  
  3. int morefile (FILE *f, char *name, int showname, FILE *mystdin)
  4. {
  5.     register int
  6.     ch,
  7.     lines = 0;
  8.     
  9.     if (showname)
  10.     printf ("--------- %s --------\n", name);
  11.  
  12.     while (1)
  13.     {
  14.     ch = fgetc (f);
  15.     if (feof (f))
  16.     {
  17.         printf ("more: q=quit, n=next file: ");
  18.         return (getinput (mystdin) != 'q');
  19.     }
  20.  
  21.     putchar (ch);
  22.     if (ch == '\n')
  23.     {
  24.         if (++lines >= 23)
  25.         {
  26.         printf ("more: q=quit, n=next file, enter=next page: ");
  27.         if ( (ch = getinput (mystdin)) == 'q')
  28.             return (0);
  29.         else if (ch == 'n')
  30.             return (1);
  31.         lines = 0;
  32.         }
  33.     }
  34.     }
  35. }
  36.